package org.ch02.job.test01;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @author XCH
 * @date 2025 - 03 - 17
 */
public class Maintest {
    public static void main(String[] args) {
        try {
            Class<?> clazz = Class.forName("org.ch02.test01.Student");
            Constructor<?> constructor = clazz.getDeclaredConstructor();
            Object obj = constructor.newInstance();
            Method method = clazz.getMethod("sayHello", String.class);
            method.invoke(obj, "张三");

        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }
}
